package com.pubinfo.passbook.data.quartz.task;

import com.pubinfo.passbook.common.service.master.TWiteoffInstanceService;
import com.pubinfo.passbook.common.service.request.tax.RequestTaxServer;
import com.pubinfo.passbook.data.service.impl.SynWriteoffInfoServiceImpl;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Date;

@Slf4j
@DisallowConcurrentExecution //作业不并发
@Component
public class SynWriteoffInfo implements Job {
    @Resource
    SynWriteoffInfoServiceImpl synWriteoffInfoService;

    @SneakyThrows
    @Override
    public void execute(JobExecutionContext context) {
        /**
         * 票据回传
         */
        log.info("定时任务成功" + new Date());
        //先同步前一天的数据
        synWriteoffInfoService.synYesterdayWriteoffInfo();
        //之后更新所有需要更新的数据
        synWriteoffInfoService.updateWriteoffInfo();
        //回传所有可以回传的票据
        synWriteoffInfoService.claimFeedback();
    }

}